using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter13
{
	/// <summary>
	/// Example01: Billiards, Anyone?
	/// Three 0.300-kg billiard balls are placed on 
	/// a table at the corners of a right triangle, 
	/// as shown in Figure 13.3. Calculate the gravitational 
	/// force on the cue ball (designated m_1) resulting from 
	/// the other two balls.
	/// F = (6.67 i + 3.75 j) \times 10^{-11} N
	/// </summary>
	public class Example01
	{
		public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Gravitation grav = new L.Gravitation();
			L.Mass m1 = new L.Mass();
			m1.kg = 0.3;
			L.Position r1 = new L.Position();
			L.Position r2 = new L.Position();
			r2.X = 0.0;
			r2.Y = 0.4;
			L.Position r3 = new L.Position();
			r3.X = 0.3;
			r3.Y = 0.0;
			L.Vector f1by2 = grav.ForceOnSecondByFirst(m1,r2,m1,r1);
			L.Vector f1by3 = grav.ForceOnSecondByFirst(m1,r3,m1,r1);
			L.Vector f = f1by2 + f1by3;
			result += Convert.ToString(f.X)+"  i+";
			result += Convert.ToString(f.Y)+"  j";
		}
	}
}
